<!DOCTYPE html>
<html>
{include file="public/header" /}
<body>


<div class="layui-fluid" id="app">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <!--<div class="layui-card-header">财务报表,提现管理</div>-->
                <div class="layui-card-body">
                    <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                        <ul class="layui-tab-title">
                            <li class="layui-this">标准</li>
                            <li>新标准</li>

                        </ul>
                        <div class="layui-tab-content" style="padding-left: 0px;padding-right: 0px">

                            <div class="layui-tab-item layui-show">

                                <!--<div>-->
                                <!--<div class="layui-btn-group">-->
                                <!--&lt;!&ndash;<button class="layui-btn ">推荐</button>&ndash;&gt;-->
                                <!--<button class="layui-btn " onclick="getCheckBox();">批量操作1</button>-->
                                <!--<button class="layui-btn" >批量操作1</button>-->
                                <!--</div>-->
                                <!--</div>-->

                                <div class="layadmin-trailer ">


                                    <table class="layui-table" lay-skin="line">

                                        <thead>
                                        <tr>
                                            <th style="width: 50px">#ID</th>
                                            <th>名称</th>
                                            <th>内容</th>
                                            <!--&lt;!&ndash;<th>创建时间</th>&ndash;&gt;-->
                                            <!--<th>品牌</th>-->
                                            <!--<th>参数</th>-->
                                            <!--<th>状态</th>-->
                                            <th></th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <tr v-for="(item,index) in items" :data_id="item.id">
                                            <td>{{item.id}}</td>
                                            <td>{{item.title}}</td>
                                            <td>{{item.content}}</td>
                                            <td style="text-align: center">



                                                <button class="layui-btn layui-btn-sm layui-btn-primary"
                                                        onclick="del(this)" :data_id="item.id" :data_index="index">
                                                    删除
                                                </button>

                                                <button class="layui-btn layui-btn-sm "
                                                        onclick="hre(this)"
                                                        :data_id="item.id" :data_index="index">
                                                    详细
                                                </button>


                                            </td>
                                        </tr>

                                        </tbody>
                                    </table>


                                </div>


                            </div>

                            <div class="layui-tab-item ">

                                <form class="layui-form" action="" lay-filter="component-form-group">
                                    <!--<div class="layui-card-header">表单组合</div>-->
                                    <div class="layui-card-body" style="padding: 15px;">

                                        <div class="layui-form-item">
                                            <label class="layui-form-label">名称</label>
                                            <div class="layui-input-block">
                                                <input type="text" name="title" lay-verify="required"
                                                       autocomplete="off"
                                                       placeholder="请输入"
                                                       class="layui-input">
                                            </div>
                                        </div>

                                        <div class="layui-form-item layui-form-text">
                                            <label class="layui-form-label">内容</label>
                                            <div class="layui-input-block">
                                                <textarea name="content" placeholder="请输入内容" rows="20"
                                                          class="layui-textarea"></textarea>
                                            </div>
                                        </div>


                                    </div>

                                    <div class="layui-form-item form-footer2">
                                        <div class="layui-input-block">
                                            <div class="layui-footer">
                                                <button class="layui-btn" lay-submit=""
                                                        lay-filter="component-form-demo1">立即提交
                                                </button>
                                                <button type="reset" class="layui-btn layui-btn-primary">重置
                                                </button>
                                            </div>
                                        </div>
                                    </div>

                                </form>


                            </div>


                        </div>
                    </div>


                </div>


            </div>

        </div>


    </div>
</div>


<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    //vue对象
    var app = new Vue({
        el: '#app',
        data: {
            check: [],
            curr: 1,//当前页
            limit: 10,//当前页
            items: []
        }
    });

    //初始数据
    function init() {
        layer.load(2);
        $.get('biaozhun_list', '',
            function (res) {
                layer.closeAll();
                app.items = res.data;
            }
        );
    }


    function del(that) {
        var id = $(that).attr('data_id');
        var index = layer.confirm('确认继续执行？', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            $.post('{:url("biaozhun_del")}', {id: id}, function (res) {
                parent.layer.close(index);
                if (res.code == 1) {
                    init();
                }

            });
        }, function () {
            parent.layer.close(index);
        });
    }



    function hre(that) {
        var id = $(that).attr('data_id');
//        location.href="{:url('detail')}?id="+id;
        layer.open({

            type: 2,
            title: '详细',
            shadeClose: true,
            shade: 0.01,
            area: ['70%', '80%'],
            content: "{:url('biaozhun_detail')}?id=" + id //iframe的url

        })


    }


    //按需引入layui模块
    layui.use(['laypage', 'layer', 'table', 'element'], function () {
        var laypage = layui.laypage
            , layer = layui.layer;
        var table = layui.table;
        var element = layui.element;
        var form = layui.form;
        element.on('tab(docDemoTabBrief)', function (data) {
//            console.log(this); //当前Tab标题所在的原始DOM元素
//            console.log(data.index); //得到当前Tab的所在下标
//            console.log(data.elem); //得到当前的Tab大容器
//            if (data.index == 0) {
//                init();
//            }
        });

        /* 监听提交 */
        form.on('submit(component-form-demo1)', function (data) {

            $.post("{:url('biaozhun_add')}", data.field, function (res) {
                if (res.code == 1) {
                    parent.layer.msg(res.msg, {icon: 1})
                    $('form')[0].reset();
                    init();
                    return false;
                } else {
                    parent.layer.msg(res.msg, {icon: 2})
                    return false;
                }
            });


            return false;
        });

        init();


    });


</script>


</body>
</html>




